<!DOCTYPE html>
<html xmlns:wb="http://open.weibo.com/wb">
<head>
  <meta charset="utf-8">
  <script src="https://cdn.jsdelivr.net/gh/Sanarous/files@1.13/js/linkcard.js"></script>
  <script>
(function(){
    var bp = document.createElement('script');
    var curProtocol = window.location.protocol.split(':')[0];
    if (curProtocol === 'https') {
        bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
    }
    else {
        bp.src = 'http://push.zhanzhang.baidu.com/push.js';
    }
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(bp, s);
})();
</script>
<script>
var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?fc9a8559a133f4d8ce784d69d6337bb0";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
</script>

  
  <title>近期生产问题和解决方案记录 | 涂宗勋的博客</title>
  <meta name="baidu-site-verification" content="o8pWlgAEZ7" />
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="description" content="前几天生产环境上线，过程不算顺利，总结下原因大概有这么几点：  前期准备工作不足，依赖的中间件软件安装后未经过充分验证，例如mongodb； 临时改配置，sit和预生产的中间件单机，生产使用集群，集群环境的使用未得到充分验证； 不可抗因素，踩到了springboot版本的bug。">
<meta property="og:type" content="article">
<meta property="og:title" content="近期生产问题和解决方案记录">
<meta property="og:url" content="https://tuzongxun.gitee.io/2020/10/23/wenti3/index.html">
<meta property="og:site_name" content="涂宗勋的博客">
<meta property="og:description" content="前几天生产环境上线，过程不算顺利，总结下原因大概有这么几点：  前期准备工作不足，依赖的中间件软件安装后未经过充分验证，例如mongodb； 临时改配置，sit和预生产的中间件单机，生产使用集群，集群环境的使用未得到充分验证； 不可抗因素，踩到了springboot版本的bug。">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2020-10-23T07:43:58.000Z">
<meta property="article:modified_time" content="2020-10-23T03:44:10.594Z">
<meta property="article:author" content="涂宗勋">
<meta property="article:tag" content="问题整理">
<meta name="twitter:card" content="summary">
  
  
    <link rel="icon" href="/images/touxiang.png">
  
  
    
  
  
<link rel="stylesheet" href="/tzxblog/css/style.css">

  

<meta name="generator" content="Hexo 4.2.1"></head>

<body>
  <div id="container">
    <div id="wrap">
      <header id="header">
  <script src="https://tjs.sjs.sinajs.cn/open/api/js/wb.js" type="text/javascript" charset="utf-8"></script>
  <script src="https://cdn.jsdelivr.net/gh/Sanarous/files@1.13/js/linkcard.js"></script>
  <div id="banner"></div>
  <div id="header-outer" class="outer">
    
    <div id="header-inner" class="inner">
      <nav id="sub-nav">
        
        <a id="nav-search-btn" class="nav-icon" title="搜索"></a>
      </nav>
      <div id="search-form-wrap">
        <form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form"><input type="search" name="q" class="search-form-input" placeholder="Search"><button type="submit" class="search-form-submit">&#xF002;</button><input type="hidden" name="sitesearch" value="https://tuzongxun.gitee.io"></form>
      </div>
      <nav id="main-nav">
        <a id="main-nav-toggle" class="nav-icon"></a>
        
          <a class="main-nav-link" href="/tzxblog/">首页</a>
        
          <a class="main-nav-link" href="/tzxblog/shuoshuo/">说说</a>
        
          <a class="main-nav-link" href="/tzxblog/archives/">归档</a>
        
          <a class="main-nav-link" href="/tzxblog/collections/">导航</a>
        
          <a class="main-nav-link" href="/tzxblog/download/">资源</a>
        
          <a class="main-nav-link" href="/tzxblog/about/">简历</a>
        
      </nav>
      
    </div>
    <div id="header-title" class="inner">
      <h1 id="logo-wrap">
        <a href="/tzxblog/" id="logo">涂宗勋的博客</a>
      </h1>
      
        <h2 id="subtitle-wrap">
          <a href="/tzxblog/" id="subtitle">java程序员，现居武汉，CSDN博客https://blog.csdn.net/tuzongxun</a>&nbsp;&nbsp;&nbsp;&nbsp;
		  <!--<span id="busuanzi_container_site_pv">【本站累计访问量:<span id="busuanzi_value_site_pv"></span>】</span>-->
        </h2>
		
      
    </div>
  </div>
</header>
      <div class="outer">
        <section id="main"><article id="post-wenti3" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/tzxblog/2020/10/23/wenti3/" class="article-date">
  <time datetime="2020-10-23T07:43:58.000Z" itemprop="datePublished">2020-10-23</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/tzxblog/categories/%E9%97%AE%E9%A2%98%E6%95%B4%E7%90%86/">问题整理</a>
  </div>

</span>
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 class="article-title" itemprop="name">
      近期生产问题和解决方案记录
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <!-- Table of Contents -->
        
        <p>前几天生产环境上线，过程不算顺利，总结下原因大概有这么几点：</p>
<ol>
<li>前期准备工作不足，依赖的中间件软件安装后未经过充分验证，例如mongodb；</li>
<li>临时改配置，sit和预生产的中间件单机，生产使用集群，集群环境的使用未得到充分验证；</li>
<li>不可抗因素，踩到了springboot版本的bug。</li>
</ol>
<a id="more"></a>

<p>以下是部分可记录供后续参考的问题和解决方案：</p>
<h2 id="mysql-sqlmode问题"><a href="#mysql-sqlmode问题" class="headerlink" title="mysql-sqlmode问题"></a>mysql-sqlmode问题</h2><p>这个问题实际不是生产的问题，是之前预生产出现的，之前没有记录，这里一并记了。</p>
<p>部署预生产后，数据库分页操作报错，这个问题遇到很多次了，只是运维同事搭建数据库时没有提前处理。</p>
<p>错误如下：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ORDER BY clause is not in GROUP BY clause and contains nonaggregated column &#39;information_schema.PROFILING.SEQ&#39; which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode&#x3D;only_full_group_by</span><br></pre></td></tr></table></figure>

<p>解决方式不算复杂，修改sql_mode即可，可参考如下博客：</p>
<p><a href="https://www.cnblogs.com/kenshinobiy/p/9580701.html" target="_blank" rel="noopener">https://www.cnblogs.com/kenshinobiy/p/9580701.html</a></p>
<h2 id="redis-value-must-not-be-null问题"><a href="#redis-value-must-not-be-null问题" class="headerlink" title="redis value must not be null问题"></a>redis value must not be null问题</h2><p>生产环境部署时，使用redis的服务一直在重启，而日志却没有任何异常。</p>
<p>开始怀疑是健康检查有问题，使用<code>http://ip:port/actuator/health</code>发现确实结果是<code>down</code>，而不是<code>up</code>，但是由于日志没有异常，难以查看更多信息。</p>
<p>为了进一步查找问题，springboot增加如下配置，使得健康检查返回信息更多一些：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">management:</span><br><span class="line">  endpoint:</span><br><span class="line">    health:</span><br><span class="line">      show-details: always</span><br></pre></td></tr></table></figure>

<p>有了上述配置之后，果然找到了问题，访问健康检查url后，发现是redis连接的健康经检查失败了。</p>
<p>诡异是，程序启动时成功的，对redis的操作都正常，只是启动成功过不了多久就持续重启。</p>
<p>再考虑到dev、sit、preprod环境都是正常的，问题点倒是缩小了，这三个环境都是单机的redis，而生产用了redis集群。</p>
<p>但是项目是支持集群模式的，代码和配置本身应该也没问题，否则也不可能正常操作redis。</p>
<p>最终，发现是<code>springboot2.3.1</code>版本有bug，这里边对redis集群的健康检查有问题，会导致redis集群模式下的健康检查失败。</p>
<p><a href="https://github.com/spring-projects/spring-boot/issues/21514" target="_blank" rel="noopener">https://github.com/spring-projects/spring-boot/issues/21514</a></p>
<p>找到了原因，解决方案就相对简单，而且不止一种选择，可以直接关闭健康检查，显然这不符合生产环境的要求。</p>
<p>也可以只关闭redis的健康检查，看起来好一点，但是如果redis真出了问题却也会导致健康检查检查不出来。</p>
<p>于是我们选择了第三种，即升级springboot的版本到解决了上述bug的版本，目前升级到了<code>2.3.4</code>。</p>
<p>第三种应该是目前较优方案，只看后续的全面回归测试是否有影响。</p>
<h2 id="gitlab的坑"><a href="#gitlab的坑" class="headerlink" title="gitlab的坑"></a>gitlab的坑</h2><p>这是一个说严重很严重，说不严重好像也不严重的问题，gitlab的web界面进行合并操作时，默认会勾选删除源分支选项。</p>
<p>在生产代码发布时，突然发现合并后原来的分支不见了，于是仔细检查了下之前的操作，便发现了上边的坑。</p>
<p>虽然重新<code>push</code>一下就没事了，但是删除本身就是个很敏感的操作，再次提醒做事需仔细，上线当小心。</p>

      
    </div>
    <footer class="article-footer">
      <a data-url="https://tuzongxun.gitee.io/2020/10/23/wenti3/" data-id="ckxn7cxkj0088kcvhgkv43gzc" class="article-share-link">分享</a>
      
      
      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tzxblog/tags/%E9%97%AE%E9%A2%98%E6%95%B4%E7%90%86/" rel="tag">问题整理</a></li></ul>

    </footer>
  </div>
  
    
  <div class="comments" id="comments">
    
     
       
       
      
      
	 
  </div>
 
    
 
<script src="/tzxblog/jquery/jquery.min.js"></script>

  <div id="random_posts">
    <h2>推荐文章</h2>
    <div class="random_posts_ul">
      <script>
          var random_count =5
          var site = {BASE_URI:'/tzxblog/'};
          function load_random_posts(obj) {
              var arr=site.posts;
              if (!obj) return;
              // var count = $(obj).attr('data-count') || 6;
              for (var i, tmp, n = arr.length; n; i = Math.floor(Math.random() * n), tmp = arr[--n], arr[n] = arr[i], arr[i] = tmp);
              arr = arr.slice(0, random_count);
              var html = '<ul>';
            
              for(var j=0;j<arr.length;j++){
                var item=arr[j];
                html += '<li><strong>' + 
                item.date + ':&nbsp;&nbsp;<a href="' + (site.BASE_URI+item.uri) + '">' + 
                (item.title || item.uri) + '</a></strong>';
                if(item.excerpt){
                  html +='<div class="post-excerpt">'+item.excerpt+'</div>';
                }
                html +='</li>';
                
              }
              $(obj).html(html + '</ul>');
          }
          $('.random_posts_ul').each(function () {
              var c = this;
              if (!site.posts || !site.posts.length){
                  $.getJSON(site.BASE_URI + 'js/posts.js',function(json){site.posts = json;load_random_posts(c)});
              } 
               else{
                load_random_posts(c);
              }
          });
      </script>
    </div>
  </div>

	
<nav id="article-nav">
  
    <a href="/tzxblog/2020/10/30/ruoyi2/" id="article-nav-newer" class="article-nav-link-wrap">
      <strong class="article-nav-caption">上一篇</strong>
      <div class="article-nav-title">
        
          若依管理系统RuoYi-Cloud版搭建记录
        
      </div>
    </a>
  
  
    <a href="/tzxblog/2020/10/16/flink3/" id="article-nav-older" class="article-nav-link-wrap">
      <strong class="article-nav-caption">下一篇</strong>
      <div class="article-nav-title">flink on yarn集群搭建及验证要点记录</div>
    </a>
  
</nav>

  
</article>

</section>
           
    <aside id="sidebar">
  
    <!--微信公众号二维码-->


  
    

  
    
  
    
    <div class="widget-wrap">
    
      <div class="widget" id="toc-widget-fixed">
      
        <strong class="toc-title">文章目录</strong>
        <div class="toc-widget-list">
              <ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#mysql-sqlmode问题"><span class="toc-number">1.</span> <span class="toc-text">mysql-sqlmode问题</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#redis-value-must-not-be-null问题"><span class="toc-number">2.</span> <span class="toc-text">redis value must not be null问题</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#gitlab的坑"><span class="toc-number">3.</span> <span class="toc-text">gitlab的坑</span></a></li></ol>
          </div>
      </div>
    </div>

  
    

  
    
  
    
  
    

  
</aside>

      </div>
      <footer id="footer">
  <script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
  
  <div class="outer">
    <div id="footer-left">
      &copy; 2016 - 2021 涂宗勋&nbsp; <a href="https://beian.miit.gov.cn/#/Integrated/recordQuery" target="_blank" rel="noopener">鄂ICP备20000142号</a> |&nbsp;&nbsp;
      主题 <a href="https://github.com/giscafer/hexo-theme-cafe/" target="_blank">Cafe</a>&nbsp;|&nbsp;&nbsp;
	  <span id="busuanzi_container_site_uv">本站有效访客数<span id="busuanzi_value_site_uv"></span>人</span>
	  <span id="busuanzi_container_site_pv" >| 总访问量 <span id="busuanzi_value_site_pv"></span> 次 </span>
	  <div style="width:300px;margin:0 auto; padding:20px 0;"><a target="_blank" href="http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=42010302002171"style="display:inline-block;text-decoration:none;height:20px;line-height:20px;"><img src="http://www.tzxcode.cn/wp-content/uploads/2020/01/备案图标.png" style="float:left;"/><p style="float:left;height:20px;line-height:20px;margin: 0px 0px 0px 5px; color:#939393;">鄂公网安备 42010302002171号</p></a>
		 	</div>
    </div>
     <div id="footer-right">
      联系方式&nbsp;|&nbsp;1160569243@qq.com
    </div>
	
  </div>
</footer>
 
<script src="/tzxblog/jquery/jquery.min.js"></script>

 <script>
$(document).ready(function() {

    var int = setInterval(fixCount, 50);  // 50ms周期检测函数
    var countOffset = 20000;  // 初始化首次数据

    function fixCount() {            
       if (document.getElementById("busuanzi_container_site_pv").style.display != "none")
        {
            $("#busuanzi_value_site_pv").html(parseInt($("#busuanzi_value_site_pv").html()) + countOffset); 
            clearInterval(int);
        }                  
        if ($("#busuanzi_container_site_pv").css("display") != "none")
        {
            $("#busuanzi_value_site_uv").html(parseInt($("#busuanzi_value_site_uv").html()) + countOffset); // 加上初始数据 
            clearInterval(int); // 停止检测
        }  
    }
       	
});
</script> 
    </div>
    <nav id="mobile-nav">
  
    <a href="/tzxblog/" class="mobile-nav-link">首页</a>
  
    <a href="/tzxblog/shuoshuo/" class="mobile-nav-link">说说</a>
  
    <a href="/tzxblog/archives/" class="mobile-nav-link">归档</a>
  
    <a href="/tzxblog/collections/" class="mobile-nav-link">导航</a>
  
    <a href="/tzxblog/download/" class="mobile-nav-link">资源</a>
  
    <a href="/tzxblog/about/" class="mobile-nav-link">简历</a>
  
</nav>
    <img class="back-to-top-btn" src="/images/fly-to-top.png"/>
<script>
// Elevator script included on the page, already.
window.onload = function() {
  var elevator = new Elevator({
    selector:'.back-to-top-btn',
    element: document.querySelector('.back-to-top-btn'),
    duration: 1000 // milliseconds
  });
}
</script>
      

  

  







<!-- author:forvoid begin -->
<!-- author:forvoid begin -->

<!-- author:forvoid end -->

<!-- author:forvoid end -->



 
<script src="/tzxblog/js/is.js"></script>



  
<link rel="stylesheet" href="/tzxblog/fancybox/jquery.fancybox.css">

  
<script src="/tzxblog/fancybox/jquery.fancybox.pack.js"></script>




<script src="/tzxblog/js/script.js"></script>


<script src="/tzxblog/js/elevator.js"></script>

  </div>
</body>
</html>